import request from "@/utils/request";

// 检查从购物车/直接购买的方式
export const checkOrder = (mode, obj) => {
  return request.get("/checkout/order", {
    params: {
      mode,
      delivery: 0, // 物流方式
      couponId: 0, // 优惠券
      isUsePoints: 0, // 是否使用积分
      ...obj, // cardId/goodsID、goodsNum、goodsSkuId
    },
  });
};

//  提交订单并支付
export const orderSubmit = (mode, params) => {
  return request.post("/checkout/submit", {
    mode,
    delivery: 10,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    ...params, // cardId、remark/goodsID、goodsNum、goodsSkuId、remark
  });
};


// Get my order list
export const getOrderList = ({page,dataType}) => {
  return request.get('/order/list',{
    params:{
      dataType,
      page
    }
  })
};
